﻿using KuiHuaBaoDian.Services.Guide;
using UnityEngine.UIElements;

namespace KuiHuaBaoDian.GuideGraph.Editor {

    [CustomElement(typeof(GuideCommand_WaitSeconds))]
    public class GuideCommand_WaitSeconds_Node : GuideGraphEntityNode {

        public GuideCommand_WaitSeconds_Node(GuideEntity entity, GuideGraphView view) : base(entity, view) {
        }

        public new GuideCommand_WaitSeconds Entity => (base.Entity as GuideCommand_WaitSeconds);

        private Label m_SecondsLabel;

        protected override void OnInitialized() {
            base.OnInitialized();
            style.minWidth = 120;

            titleLabelContainer.Add(new Label("等待"));
            m_SecondsLabel = new Label();
            titleLabelContainer.Add(m_SecondsLabel);
            titleLabelContainer.Add(new Label("秒"));
            PropertyChanged += () => {
                m_SecondsLabel.text = $"{Entity.Seconds}";
            };
        }
    }
}
